/**
 * Created by zander on 2017/12/5.
 */

function jobStatus(id, btn) {
    $.ajax({
        type: "POST",
        url: "/intest/getjobStatus",
        data: {id: id},
        async: true,
        dataType: "json",
        success: function (ret) {
            if (ret.status == "0000") {
                $("#btnruner" + btn).removeAttr("disabled");
            }
        },
    });
}
function saveEmail() {
    var eamil = $("#Addemail").val();
    var sessionStorage = window.sessionStorage;
    sessionStorage.setItem('myemail', eamil);
    $('#myEmail').modal('hide');
}

function run20() {
    $("#btnruner20").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        // var name = "Test";
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 20, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner20").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run25() {
    $("#btnruner25").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 25, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner25").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run3() {
    $("#btnruner3").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 25, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner3").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run35() {
    $("#btnruner35").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 35, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner35").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run7() {
    $("#btnruner7").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 7, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner7").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run6() {
    $("#btnruner6").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 15, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner6").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run5() {
    $("#btnruner5").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 5, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner5").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run37() {
    $("#btnruner37").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 37, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner37").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}

function run9() {
    $("#btnruner9").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 7, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner9").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run10() {
    $("#btnruner10").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 27, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner10").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}
function run41() {
    $("#btnruner41").button('loading').queue(function () {
        var sessionStorage = window.sessionStorage;
        var myemail = sessionStorage.getItem('myemail');
        var localStorage = window.localStorage;
        var name = localStorage.getItem('name');
        $.ajax({
            type: "POST",
            url: "/intest/buildjob",
            data: {jobid: 41, email: myemail, username: name},
            dataType: "json",
            success: function (ret) {
                if (ret.status == "0000") {
                    $("#btnruner41").attr("disabled", "disabled");
                }
            },
        });
        window.sessionStorage.clear();
    });
}


function sessionClear() {
    window.sessionStorage.clear();
}

window.onload = sessionClear();
//闪电借款极速
window.onload = jobStatus(20, 20);
//闪电借款全流程
window.onload = jobStatus(25, 25);
// window.onload = jobStatus(25,3);
//闪电借款授信
window.onload = jobStatus(35, 35);
//掌e贷全流程
window.onload = jobStatus(7, 7);
// window.onload = jobStatus(15,6);
//掌e贷极速
window.onload = jobStatus(5, 5);
//掌e贷款授信
window.onload = jobStatus(37, 37);
// window.onload = jobStatus(7,9);
// window.onload = jobStatus(27,10);
//掌众财富
window.onload = jobStatus(41,41);

